package org.gpf.simpleFactory.markDiscount;
/**
 * 返利收费子类
 * @author gaopengfei
 * @date 2015-4-26 下午11:22:39
 */
public class CashReturn extends CashSuper {

	private double moneyCondition;
	private double moneyReturn;
	
	/**
	 * 初始化的时候必须输入返利条件和返利值。例如满300减100则返利条件为300，返利值是100
	 * @param moneyCondition 返利条件
	 * @param moneyReturn 返利值
	 */
	public CashReturn(double moneyCondition, double moneyReturn) {
		this.moneyCondition = moneyCondition;
		this.moneyReturn = moneyReturn;
	}

	@Override
	public double acceptCash(double money) {

		return money >= moneyCondition ? money - moneyReturn : money;
	}

}
